package com.qzsoft.zhjd.machine.modules.machinefuel.controller;

import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.qzsoft.jeemis.common.utils.Result;
import com.qzsoft.zhjd.common.utils.ResultUtils;
import com.qzsoft.zhjd.machine.modules.machinefuel.service.MachineFuelService;

/**
 * @ClassName MachineFuelController
 * @Description 实时油位控制器
 * @author linhuawei
 * @since 2021-11-04
 */
@RestController
@RequestMapping("/api/machineFuel")
public class MachineFuelController {

    @Autowired
    private MachineFuelService machineFuelService;

    /**
     * @Title list
     * @Description 获取设备指定日期油位数据
     * @param machineId 设备主键
     * @param date      日期
     * @return 油位数据
     */
    @RequiresPermissions("api:machineFuel:list")
    @GetMapping("/list")
    public Result<Map<String, Object>> list(@RequestParam(required = true) String machineId,
            @RequestParam(required = false) String date) {
        Map<String, Object> map = machineFuelService.listByMachineIdAndDate(machineId, date);
        return ResultUtils.ok(map);
    }

}
